package my.project.zuul;

import my.project.zuul.filter.AccessFilter;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

/**
 * Created by 哲 on 2016/11/29.
 * 这里用了@SpringCloudApplication注解，之前没有提过，通过源码看到，
 * 它整合了@SpringBootApplication、@EnableDiscoveryClient、@EnableCircuitBreaker
 */
@EnableZuulProxy
@SpringCloudApplication
public class ZuulApplication {

    @Bean
    public AccessFilter accessFilter(){
        return new AccessFilter();
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
    }

}
